package cl.thesouthfun.mantenedor.util;

public class Util {
	

	public static boolean validateRut(String strRut)
	{
		String dv = strRut.substring(strRut.length()-1, strRut.length()).toUpperCase();
		
		int rut = Integer.parseInt(strRut.substring(0, strRut.length()-1));
		int m = 0;
		int s = 1;

		for (; rut != 0; rut /= 10) {
			s = (s + rut % 10 * (9 - m++ % 6)) % 11;
		}
		
		return String.valueOf((char) (s != 0 ? s + 47 : 75)).toUpperCase().equals(dv);

	}

}
